﻿using System;
using System.Collections.Generic;
using ContractManager.Entity;
using Speed.Data;

namespace ContractManager.BLL.Business
{
    public static class ClsRevenueDetails
    {
        public static List<RevenueDetails> SelectAll()
        {
            using (var db = Sys.NewDb())
            {
                return Data.Base.RevenueDetails.Select(db);
            }
            
        }

        public static void Insert(RevenueDetails capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Insert<RevenueDetails>(capital);
            }
            
        }

        public static void Update(RevenueDetails capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Update<RevenueDetails>(capital);
            }
            
        }

        public static RevenueDetails SelectByPk(Int32 revDetId)
        {
            using (var db = Sys.NewDb())
            {
                return db.SelectSingle<RevenueDetails>(string.Format("RevDetId={0}", revDetId));
            }
            
        }

        public static List<RevenueDetails> SelectByMaster(Int32 revId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Select<RevenueDetails>(string.Format("RevId={0}", revId));
            }
            
        }

        public static int DeleteByPk(Int32 revDetId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<RevenueDetails>(string.Format("RevDetId={0}", revDetId));
            }
            
        }
    }
}